#include "StdAfx.h"
#include "rscjprops.h"

rscjprops::rscjprops(){
}

rscjprops::rscjprops(double Rn,double Ic,double C, double w)
{
	this->Rn=abs(Rn);
	this->Ic=abs(Ic);
	this->C=abs(C);
	this->w=abs(w);
	this->normalized=false;
	
	this->calcbeta();
	this->calcomegac();
	this->calcomega();

}
rscjprops::rscjprops(long double betac,long double omega)
{
	this->Rn=-1.0;
	this->Ic=-1.0;
	this->C=-1.0;
	this->w=-1.0;
	this->normalized=true;
	this->betac=betac;
	this->omega=omega;


}


rscjprops::~rscjprops(void)
{
}

bool rscjprops::isnormalized(){
	return this->normalized;
}
void rscjprops::setnormalized(bool norm){
	this->normalized=norm;
}
void rscjprops::setRn(long double Rn){
	this->Rn=abs(Rn);
	this->normalized=false;
	this->calcbeta();
	this->calcomegac();
	this->calcomega();
}
void rscjprops::setIc(long double Ic){
	this->Ic=abs(Ic);
	this->iac=this->Iac/Ic;
	
	this->normalized=false;
	this->calcbeta();
	this->calcomegac();
	this->calcomega();
}
void rscjprops::setC(long double C){
	this->C=abs(C);
	this->normalized=false;
	this->calcbeta();
	this->calcomegac();
	this->calcomega();
}
void rscjprops::setw(long double w){
	this->w=abs(w);
	this->normalized=false;
	this->calcbeta();
	this->calcomegac();
	this->calcomega();
}
void rscjprops::setIac(long double Iac){
	this->Iac=abs(Iac);
	if(this->Ic>0){
	this->iac=Iac/this->Ic;
	}
	this->normalized=false;
}

void rscjprops::setiac(long double iac){
	this->Iac=-1;
	this->iac=iac;
	this->normalized=true;
}
void rscjprops::seth(long double h){
	this->h=h;
}
void rscjprops::setprops(long double Rn,long double Ic,long double C, long double w)
{
	this->Rn=abs(Rn);
	this->Ic=abs(Ic);
	this->C=abs(C);
	this->w=abs(w);
	this->normalized=false;
	
	this->calcbeta();
	this->calcomegac();
	this->calcomega();
}
void rscjprops::setprops(long double betac,long double omega)
{
	this->Rn=-1.0;
	this->Ic=-1.0;
	this->C=-1.0;
	this->w=-1.0;
	this->normalized=true;
	this->betac=betac;
	this->omega=omega;


}

void rscjprops::setomega(long double omega){
	this->Rn=-1.0;
	this->Ic=-1.0;
	this->C=-1.0;
	this->w=-1.0;

	this->normalized=true;
	this->omega=omega;
}
void rscjprops::setbetac(long double betac){
	this->Rn=-1.0;
	this->Ic=-1.0;
	this->C=-1.0;
	this->w=-1.0;

	this->normalized=true;
	this->betac=betac;
}

double rscjprops::getRn(){
	return this->Rn;
}
double rscjprops::getIc(){
	return this->Ic;
}
double rscjprops::getC(){
	return this->C;
}
double rscjprops::getw(){
	return this->w;
}
double rscjprops::getIac(){
	return this->Iac;
}
double rscjprops::getiac(){
	return this->iac;
}
long double rscjprops::geth(){
	return this->h;
}
long double rscjprops::getbetac(){
	return this->betac;
}
long double rscjprops::get_wc(){
	return this->wc;
}
long double rscjprops::getomega(){
	return this->omega;
}


void rscjprops::calcbeta(){
	if(!this->normalized){
	//this->betac=(2.0*el*this->Ic*pow(this->Rn,2)*this->C)/(hbar);
		this->betac=(2.0*1.60217656535*this->Ic*pow(this->Rn,2)*this->C)/(1.05457172647e-3);
	}
}
void rscjprops::calcomegac(){
	if(!this->normalized){
	//this->wc=(2.0*el*this->Ic*this->Rn)/(hbar);
		this->wc=(2.0*1.60217656535*this->Ic*this->Rn)/(1.05457172647e-12);
	}
}
void rscjprops::calcomega(){
	if(!this->normalized && wc!=0){
	this->omega=w/wc;
	}
}